<template>
  <div class="content-wrap">
    <van-nav-bar title="设置备注信息" left-text="取消" right-text="完成" @click-left="onClickLeft"
                 @click-right="onClickRight">
    </van-nav-bar>

    <van-cell-group title="备注名">
      <van-field v-model="remarks" placeholder="请输入备注名" clearable maxlength="20"/>
    </van-cell-group>
  </div>
</template>

<script>
  import Socket from '../../utils/socket'

  export default {
    name: 'setRemarks',
    data () {
      return {
        remarks: ''
      }
    },
    methods: {
      onClickLeft () {
        this.$router.go(-1)
      },
      onClickRight () {
        Socket.sendData('FriendsDoNick', { nickname: this.remarks, fid: this.$route.params.id }).then(res => {
          if (res.action === 20008 && res.msg === 'ok') {
            this.$router.go(-1)
          } else {
            this.$toast(res.msg)
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
